package com.maxt.common.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 配置文件处理
 *
 */
public class PropertyUtil {
	private static Properties p1 = null;

	public static Properties getProperties() {
		if (p1 == null) {
			synchronized (PropertyUtil.class) {
				if (p1 == null) {
					p1 = new Properties();
					InputStream inputStream = PropertyUtil.class.getClassLoader()
							.getResourceAsStream("config.properties");
					if (inputStream == null) {
						throw new RuntimeException("config.properties");
					}
					try {
						p1.load(inputStream);
					} catch (IOException e) {
						throw new RuntimeException("配置文件加载异常");
					}
				}
			}
		}
		return p1;
	}

	public static void main(String[] args) {
		System.out.println(getProperties().getProperty("smsText"));
	}
}
